﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace University.Workshop.Presenters.CollectControl.FineCollectControl.Read
{
    public class PresenterReadFineCollectControl
    {
        public IReadFineCollectControlView view;
        public Model.FineCollectControl fine;

        public PresenterReadFineCollectControl(IReadFineCollectControlView view, Model.FineCollectControl f)
        {
            this.view = view;
            this.fine = new Model.FineCollectControl() { 
                CollectId = f.CollectId,
                CollectPayDate = f.CollectPayDate,
                CollectType = f.CollectType,
                ControlDate = f.ControlDate,
                ControlDetail =f.ControlDetail,
                DateGenerated = f.DateGenerated,
                Estructura = f.Estructura,
                IsPaid = f.IsPaid,
                Kardex =f.Kardex,
                KardexId = f.KardexId,
                PaymentAmount =f.PaymentAmount,
                User =f.User,
                UserId = f.UserId
            };
        }

        public void LoadDataToView()
        {
            view.Allotment = fine.Kardex.Allotment.First().AllotmentName;
            view.Square = fine.Kardex.Allotment.First().Square.SquareId;
            view.NamePartner = fine.Kardex.Person.Names + " " + fine.Kardex.Person.LastNames;
            view.CiPartner = fine.Kardex.Person.PersonId;
            view.ControlDetail = fine.ControlDetail;
            view.PaymentDate = fine.CollectPayDate.Value;
            view.Amount = fine.PaymentAmount;
            view.ChargeType = ((Model.FineType)fine.CollectType).ToString();
        }
    }
}
